/*
 * Document.h
 *
 *  Created on: Sep 21, 2011
 *      Author: zwx
 */

#ifndef DOCUMENT_H_
#define DOCUMENT_H_
#include "../Include/includes.h"
using namespace std;
struct term_info{
	size_t id;
	size_t count;
	string pos_list;
};

class Document {
public:
	size_t docID;
	int	docType;			//0 news; 1 wiki
	int sec_count;			//section count for wiki
	int ref_count;			//reference count for wiki
	size_t semWikiID;
	size_t length;			//token wise length (the total number of tokens
	//map<string, size_t>	termFwdPosting;		//term_name, term_offset in the semwiki (token wise)
	map<string, struct term_info> fwdPosting;
	set<string>	authorFwdPosing;
	set<string>	categoryFwdPosting;
	set<string> destLinkList;
	string docName;
	string docPath;
	string semWiki;

	Document(string path, string name, int type, size_t id);
	virtual ~Document();

	inline void setSemWikiID(size_t id) {semWikiID = id;}
	//inline void setTermFwdPosting(string term, size_t offset) {termFwdPosting.insert(make_pair(term, offset));}
	void setFwdPosting(string term, string offset);
	inline void setAuthorFwdPosting(string author) {authorFwdPosing.insert(author);}
	inline void setCategoryFwdPosting(string cat) {categoryFwdPosting.insert(cat);}
	inline void setSemWiki(string content) {semWiki.append(content);}
	inline void setDestLikList(string dest) {destLinkList.insert(dest);}
	inline string getName() { return docName; }
	inline string getPath() {return docPath; }
	inline size_t getSemWikiID() {return semWikiID;}
};

#endif /* DOCUMENT_H_ */
